package com.web.portal.dao;

import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.web.portal.entity.TransferCredit;
@Repository (value="transferCreditDao")

public class TransferCreditDaoImpl extends WebportalBaseDao<TransferCredit> implements TransferCreditDao{
private static final Logger LOG= Logger.getLogger(TransferCreditDaoImpl.class);
	

	

	

	public List<TransferCredit> listItems(TransferCredit instance) {
		// TODO Auto-generated method stub
		try{
			List<TransferCredit> result= getSession().createQuery("from TransferCredit").list();
			if(result.isEmpty()){
			LOG.debug("Empty list of TransferCredit.....................");	
			}
			
			LOG.debug("Successfully return the list of transfer credit................");
			return result;
		}catch(HibernateException e){
			e.printStackTrace();
			throw e;
		}
	}

	

	@Override
	protected void populateCriteria(
			Map<? extends Enum<?>, Object> searchCriteria, Criteria criteria) {
		if(searchCriteria.containsKey(TransferCreditSearchType.ID)){
			criteria.add(Restrictions.eq("id", searchCriteria.get(TransferCreditSearchType.ID)));
		}
	}

}
